CC = g++

BGMERGE = -DBGMERGE
DEBUG =	-g -ggdb -DINFO

#detect OS,support Linux and Mac OS
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
	CFLAGS = -W -Wall -Werror -fPIC
	LDFLAGS=-fPIC -shared
	LIB_EXTENSION=so
endif

LIB_OBJS = \
	./md5.o

LIBRARY = vhsmd5.$(LIB_EXTENSION)

SOCFLAGS= -g -fPIC $(LDFLAGS) $(CFLAGS)
RM= rm -f

all: $(LIBRARY)

md5.o: md5.cpp
	$(CC) $(SOCFLAGS) -c -o $@ $<

#all :
#	gcc -shared -fPIC  vhs.cpp -o vhsmd5.so


$(LIBRARY): $(LIB_OBJS)
	$(CC) $(LDFLAGS) $(LIB_OBJS)  vhs.cpp -o vhsmd5.$(LIB_EXTENSION)

clean:
	$(RM) *.o *.so *.obj *.lib *.exp *.dll *.manifest
